package com.mapforge.map.tools.undo;

import javax.swing.ImageIcon;
import javax.swing.undo.UndoableEdit;

/**
 * This class is used to represent edits which can be undone and redone.  Examples include renaming
 * map's, tilesets, or tilelayers, writing
 * @author William Morrison
 *
 */
public abstract class UndoRedo implements UndoableEdit {
	/**
	 * Icon used to represent this edit 
	 */
	private ImageIcon icon;

	/**
	 * Short description of this edit
	 */
	private String description;

	/** 
	 * 
	 * @param icon
	 * @param description
	 */
	public UndoRedo(ImageIcon icon, String description) {
		this.icon = icon;
		this.description = description;
	}

	/** */
	public String getDescription() {
		return description;
	}

	/** */
	public ImageIcon getIcon() {
		return icon;
	}

	public abstract void undo();
	public abstract void redo();
	public abstract void die();

	/** */
	public void setIcon(ImageIcon icon) {
		this.icon = icon;
	}

	public boolean addEdit(UndoableEdit edit) {
		return false;
	}

	public boolean canRedo() {
		return true;
	}

	public boolean canUndo() {
		return true;
	}


	public String getPresentationName() {
		return description;
	}

	public String getRedoPresentationName() {
		return null;
	}

	public String getUndoPresentationName() {
		return null;
	}

	public boolean isSignificant() {
		return false;
	}

	public boolean replaceEdit(UndoableEdit edit) {
		return false;
	}
}
